﻿var config = {
    loadLeftMenu: function (c) {
        var main = $('<ul class="main-list"></ul>');
        $(c).each(function () {
            var itemMain = $('<li class="main-item"></li>');
            main.append(itemMain);

            if (typeof (this.text) != 'undefined') {
                itemMain.text(this.text);
            }

            var itemSub = $('<li><ul class="sub-list"></ul></li>');
            main.append(itemSub);
            if (typeof (this.sub) != 'undefined') {
                $(this.sub).each(function () {
                    var itemSubItem = $('<li class="sub-item"></li>');
                    itemSub.append(itemSubItem);

                    if (typeof (this.text) != 'undefined') {
                        itemSubItem.text(this.text);
                    }

                    if (typeof (this.href) != 'undefined') {
                        itemSubItem.prop('$href', this.href);
                    }
                });
            }
        });
        return main;
    }
};